{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport YearHeader from \"./YearHeader\";\nimport YearBody, { YEAR_COL_COUNT } from \"./YearBody\";\nimport { createKeyDownHandler } from \"../../utils/uiUtil\";\nexport var YEAR_DECADE_COUNT = 10;\nfunction YearPanel(props) {\n  var prefixCls = props.prefixCls,\n    operationRef = props.operationRef,\n    onViewDateChange = props.onViewDateChange,\n    generateConfig = props.generateConfig,\n    value = props.value,\n    viewDate = props.viewDate,\n    sourceMode = props.sourceMode,\n    _onSelect = props.onSelect,\n    onPanelChange = props.onPanelChange;\n  var panelPrefixCls = \"\".concat(prefixCls, \"-year-panel\"); // ======================= Keyboard =======================\n\n  operationRef.current = {\n    onKeyDown: function onKeyDown(event) {\n      return createKeyDownHandler(event, {\n        onLeftRight: function onLeftRight(diff) {\n          _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n        },\n        onCtrlLeftRight: function onCtrlLeftRight(diff) {\n          _onSelect(generateConfig.addYear(value || viewDate, diff * YEAR_DECADE_COUNT), 'key');\n        },\n        onUpDown: function onUpDown(diff) {\n          _onSelect(generateConfig.addYear(value || viewDate, diff * YEAR_COL_COUNT), 'key');\n        },\n        onEnter: function onEnter() {\n          onPanelChange(sourceMode === 'date' ? 'date' : 'month', value || viewDate);\n        }\n      });\n    }\n  }; // ==================== View Operation ====================\n\n  var onDecadeChange = function onDecadeChange(diff) {\n    var newDate = generateConfig.addYear(viewDate, diff * 10);\n    onViewDateChange(newDate);\n    onPanelChange(null, newDate);\n  };\n  return /*#__PURE__*/React.createElement(\"div\", {\n    className: panelPrefixCls\n  }, /*#__PURE__*/React.createElement(YearHeader, _extends({}, props, {\n    prefixCls: prefixCls,\n    onPrevDecade: function onPrevDecade() {\n      onDecadeChange(-1);\n    },\n    onNextDecade: function onNextDecade() {\n      onDecadeChange(1);\n    },\n    onDecadeClick: function onDecadeClick() {\n      onPanelChange('decade', viewDate);\n    }\n  })), /*#__PURE__*/React.createElement(YearBody, _extends({}, props, {\n    prefixCls: prefixCls,\n    onSelect: function onSelect(date) {\n      onPanelChange(sourceMode === 'date' ? 'date' : 'month', date);\n      _onSelect(date, 'mouse');\n    }\n  })));\n}\nexport default YearPanel;","map":{"version":3,"names":["_extends","React","YearHeader","YearBody","YEAR_COL_COUNT","createKeyDownHandler","YEAR_DECADE_COUNT","YearPanel","props","prefixCls","operationRef","onViewDateChange","generateConfig","value","viewDate","sourceMode","_onSelect","onSelect","onPanelChange","panelPrefixCls","concat","current","onKeyDown","event","onLeftRight","diff","addYear","onCtrlLeftRight","onUpDown","onEnter","onDecadeChange","newDate","createElement","className","onPrevDecade","onNextDecade","onDecadeClick","date"],"sources":["/data/messenger.client/node_modules/rc-picker/es/panels/YearPanel/index.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport YearHeader from \"./YearHeader\";\nimport YearBody, { YEAR_COL_COUNT } from \"./YearBody\";\nimport { createKeyDownHandler } from \"../../utils/uiUtil\";\nexport var YEAR_DECADE_COUNT = 10;\n\nfunction YearPanel(props) {\n  var prefixCls = props.prefixCls,\n      operationRef = props.operationRef,\n      onViewDateChange = props.onViewDateChange,\n      generateConfig = props.generateConfig,\n      value = props.value,\n      viewDate = props.viewDate,\n      sourceMode = props.sourceMode,\n      _onSelect = props.onSelect,\n      onPanelChange = props.onPanelChange;\n  var panelPrefixCls = \"\".concat(prefixCls, \"-year-panel\"); // ======================= Keyboard =======================\n\n  operationRef.current = {\n    onKeyDown: function onKeyDown(event) {\n      return createKeyDownHandler(event, {\n        onLeftRight: function onLeftRight(diff) {\n          _onSelect(generateConfig.addYear(value || viewDate, diff), 'key');\n        },\n        onCtrlLeftRight: function onCtrlLeftRight(diff) {\n          _onSelect(generateConfig.addYear(value || viewDate, diff * YEAR_DECADE_COUNT), 'key');\n        },\n        onUpDown: function onUpDown(diff) {\n          _onSelect(generateConfig.addYear(value || viewDate, diff * YEAR_COL_COUNT), 'key');\n        },\n        onEnter: function onEnter() {\n          onPanelChange(sourceMode === 'date' ? 'date' : 'month', value || viewDate);\n        }\n      });\n    }\n  }; // ==================== View Operation ====================\n\n  var onDecadeChange = function onDecadeChange(diff) {\n    var newDate = generateConfig.addYear(viewDate, diff * 10);\n    onViewDateChange(newDate);\n    onPanelChange(null, newDate);\n  };\n\n  return /*#__PURE__*/React.createElement(\"div\", {\n    className: panelPrefixCls\n  }, /*#__PURE__*/React.createElement(YearHeader, _extends({}, props, {\n    prefixCls: prefixCls,\n    onPrevDecade: function onPrevDecade() {\n      onDecadeChange(-1);\n    },\n    onNextDecade: function onNextDecade() {\n      onDecadeChange(1);\n    },\n    onDecadeClick: function onDecadeClick() {\n      onPanelChange('decade', viewDate);\n    }\n  })), /*#__PURE__*/React.createElement(YearBody, _extends({}, props, {\n    prefixCls: prefixCls,\n    onSelect: function onSelect(date) {\n      onPanelChange(sourceMode === 'date' ? 'date' : 'month', date);\n\n      _onSelect(date, 'mouse');\n    }\n  })));\n}\n\nexport default YearPanel;"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,QAAQ,IAAIC,cAAc,QAAQ,YAAY;AACrD,SAASC,oBAAoB,QAAQ,oBAAoB;AACzD,OAAO,IAAIC,iBAAiB,GAAG,EAAE;AAEjC,SAASC,SAAS,CAACC,KAAK,EAAE;EACxB,IAAIC,SAAS,GAAGD,KAAK,CAACC,SAAS;IAC3BC,YAAY,GAAGF,KAAK,CAACE,YAAY;IACjCC,gBAAgB,GAAGH,KAAK,CAACG,gBAAgB;IACzCC,cAAc,GAAGJ,KAAK,CAACI,cAAc;IACrCC,KAAK,GAAGL,KAAK,CAACK,KAAK;IACnBC,QAAQ,GAAGN,KAAK,CAACM,QAAQ;IACzBC,UAAU,GAAGP,KAAK,CAACO,UAAU;IAC7BC,SAAS,GAAGR,KAAK,CAACS,Q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